---
name: compose
menu: 5. Utils
---

# compose

The compose utility is a factory version of Compose component.  
You can read more about in Compose docs.

```js
import { compose, Counter, Toggle } from 'react-powerplug' // note lowercased (c)ompose

// the order matters
const ToggleCounter = compose(
  <Counter initial={5} />, // accept a element
  Toggle,                  // or just a component
)

<ToggleCounter>
  {(counter, toggle) => {
    // counter.inc, counter.dec, counter.count
    // toggle.on, toggle.toggle, etc.
  }}
</ToggleCounter>
```
